/**
 * 
 */
package com.seascape.swms.system.model;

import com.seascape.swms.framework.beetsql.View;

/**
 * @author Lay
 *
 */
public class UserRoleView implements View{
	
	public static final String SQL = "select t1.*,t3.id as roleId,t3.code as roleCode,t3.name as roleName from s_user t1,s_user_role t2,s_role t3 where t1.id=t2.user_id and t3.id=t2.role_id";

	public static final String ROLE_SQL = "select t3.* from s_user t1,s_user_role t2,s_role t3 where t1.id=t2.user_id and t3.id=t2.role_id";
	
	@Override
	public String getSql() {
		return SQL;
	}

	/* (non-Javadoc)
	 * @see com.seascape.swms.framework.beetsql.View#getSqlByClass(java.lang.Class)
	 */
	@Override
	public String getSqlByClass(Class clazz) {
		if(Role.class.isAssignableFrom(clazz)) {
			return ROLE_SQL;
		}else {
			return SQL;
		}
	}

}
